<?php

namespace app\api\controller;

use app\common\controller\Api;
use app\common\model\Banner;
use app\common\model\Company;
use app\common\model\forest\Member;
use app\common\model\Goods;
use app\common\model\ScoreLog;
use app\common\model\User;

/**
 * 首页接口
 */
class Index extends Api
{
    protected $noNeedLogin = ['*'];
    protected $noNeedRight = ['*'];

    public function ceshi()
    {
        // $dd= ScoreLog::income(3, 100, 2, 100, );

        // dd($dd);
    }
    /**
     * 首页
     *
     */
    public function index()
    {
        $data['banner'] = Banner::all();
        $data['boutique_recommendation'] = config('site.boutique_recommendation') ? cdnurl(config('site.boutique_recommendation'), true) : '';
        $data['product_member'] = config('site.product_member') ? cdnurl(config('site.product_member'), true) : '';
        $data['forest_member'] = config('site.forest_member') ? cdnurl(config('site.forest_member'), true) : '';
        $data['goodsList'] = Goods::all(['state' => 2]);
        $data['member'] = Member::getForestMemberList($this->auth->id);
        $data['company'] = Company::order('id desc')->find();
        $this->success('', $data);
    }
}
